package netty.test20TcpMergeSpilt;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import netty.test19Channelhandler.MyClientHandler;
import netty.test19Channelhandler.MyLongDecoder;
import netty.test19Channelhandler.MyLongEncoder;

/**
 * 出站是从handler链表 的尾部往头执行，所以下面的是先执行MyClientHandler 再执行 MyClientLongEncoder
 * server 和client正好相反
 */
public class MyTcpClientInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        ChannelPipeline pipeline = socketChannel.pipeline();
        //1，加入一个出站的handler 对数据进行编码
        pipeline.addLast(new MyTcpClientHandler());



    }
}
